package com.my.chapter4;

public class practice9 {
    public static void main(String[] args) {
        fibonacci(8);
    }
    static void fibonacci(int n){
        StringBuilder sb = new StringBuilder();
        sb.append("1,1");
        int i=1;
        int j=1;
        int k=2;
        while(k<=n){
            sb.append(","+k);
            i=j;
            j=k;
            k=i+j;
        }
        System.out.println(sb.toString());
    }
}
